/**
 * @author Tobias Boehm
 *
 * 29.03.2011
 */
package org.anddev.andengine.extension.tbsengine.player;

import java.util.UUID;

import org.anddev.andengine.extension.tbsengine.shared.IImageOrTextSelectableItem;

import android.graphics.drawable.Drawable;


/**
 * This is the base player class.
 * 
 * @author Tobias Boehm
 *
 */
public class BasePlayer implements Comparable<BasePlayer>, IImageOrTextSelectableItem{
	
	protected final UUID mPlayerID;
	protected String mPlayerName;
	
	public BasePlayer(final UUID pPlayerID){
		
		this("", pPlayerID);
	}
	
	public BasePlayer(final String pPlayerName, final UUID pPlayerID){
		
		this.mPlayerID = pPlayerID;
		this.mPlayerName = pPlayerName;
	}
	
	public String getPlayerName() {
		return mPlayerName;
	}

	public void setPlayerName(String mPlayerName) {
		this.mPlayerName = mPlayerName;
	}

	public UUID getPlayerID() {
		return mPlayerID;
	}

	@Override
	public Drawable getIcon() {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public boolean equals(Object o) {
		
		if(o instanceof BasePlayer){
			
			return (this.getPlayerID().equals(((BasePlayer)o).getPlayerID()));
			
		}else{
		
			return super.equals(o);
		}
	}
	
	@Override
	public int compareTo(BasePlayer another) {
	
		if(this.getPlayerID().equals(another.getPlayerID())){
			
			return 0;
		
		}else{
			
			return -1;
		}
	}
	
	@Override
	public int hashCode() {
		
		return this.mPlayerID.hashCode();
	}

	@Override
	public String getName() {
		
		return mPlayerName;
	}
}
